exports.add=[
{
	_type:"controller",
	_config_details: {
	},
	_config: {
		path:"adminpanel/",
		name:"AdminNavigation",
		admin:1
	},
	/**
	 * Controller: AdminNavigation.index 
	 *
	 * Returns:
	 *		HTML
	 */
	index: function(config) {
		var myself="controllers/adminpanel/AdminNavigation";
		var sections=[
			{code:"contents",name:this.F("Views","L",myself,"Contents",2),items:[]},
			{code:"design",name:"Внешний вид",items:[]},
			{code:"settings",name:"Настройка сайта",items:[]},
			{code:"hardsettings",name:"Сложные настройки",items:[]},
			{code:"modules",name:"Модули",items:[]}
		];
		var section_coded={};
		for (var i=0;i<sections.length;i++) section_coded[sections[i].code]=sections[i];

		var cnow="";
		var arr=this.action.match(/\/admin-(\w+)/);
		if (arr) cnow=arr[1];
		for (var k in this.site.controllers) {
			var _config=this.site.controllers[k]._config;
			var fullname="controllers/"+_config.path+_config.name;
			var _admin_nav=this.site.controllers[k]._admin_nav;
			if (!_admin_nav) continue;
			if (_config.role_code && !this.roles[_config.role_code]) continue;
			for (var i=0;i<_admin_nav.length;i++) {
				var c=_admin_nav[i];
				if (!section_coded[c.section]) {
					var cc=section_coded[c.section]={code:c.section,name:c.section,items:[]};
					sections.push(cc);
				}
				section_coded[c.section].items.push({controller:k,mode:c.mode,name:this.F("Views","L",fullname,c.name,2),active:(cnow==k)?1:0});
			}
		}
		this.admin_navigation=sections;
		return this.Cview();
	}
}];

